//
//  WJCommonUtils.h
//  ChiShaNe
//
//  Created by 王军 on 16/3/25.
//  Copyright © 2016年 王军. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface WJCommonUtils : NSObject

//字符串处理
+(BOOL)isBlankString:(NSString *)string;
+(NSString *)str2def:(NSString *)string def:(NSString *)def;
+(NSString*)obj2str:(id)obj;
+(BOOL)string:(NSString *)str containStr:(NSString *)subStr;
+(NSString *)filterHTML:(NSString *)html;
+(BOOL) isNumberic:(NSString *)str;
+(BOOL) isValidateTel:(NSString *)tel;
+(BOOL) isValidateMobile:(NSString *)mobile;
+(BOOL)isValidateEmail:(NSString *)email;
+ (BOOL)isValidateIPV4:(NSString *)ipStr;
+(NSString *)md5:(NSString *)input;
+(BOOL)checkSpecilChar:(NSString*)str charSetStr:(NSString *)charSetStr;
+(NSString *)KBMGT_float:(CGFloat )sumValue;
+(NSString *)KBMGT_float_0:(CGFloat )sumValue;
+(NSString *)KBMGT_float_1:(CGFloat )sumValue;

//字符串json
+(NSString *)JSONStringify:(id) obj;
+(id)JSONParse:(id) obj;

#pragma mark -- 数据持久
+(void)saveValue:(id)v withKey:(NSString *)key;
+(id)getValueWithKey:(NSString*)key;
+(NSString *)getStringWithKey:(NSString*)key;

+(void)archiveKey:(NSString *)key value:(id)value;
+(id)archiveGetValue:(NSString *)key;
+(void)cleanArchiveDataWithKey:(NSString *)key;

//图片
+ (UIImage *) imageFromColor:(UIColor *)color;
+ (NSData *)zipImageWithImage:(UIImage *)image maxFileSize:(CGFloat)maxFileSize;

//UIKit
+(void)closeKeyboard;
+(UIViewController *)viewController:(UIView*)subView ;
+(void)removeSubviews:(UIView *)view;
+(CGSize)getSizeTxt:(UILabel *)lbl;
+(CGFloat)valueHeight:(UILabel *)valuelbl;
+(void)callPhone:(NSString *)phoneNo;

//记录密码
+(void)savePassord:(NSString *)pwd withId:(NSString *)username withKey:(NSString *)keyStr;
+(NSString *)getPassordWithId:(NSString *)username withKey:(NSString *)keyStr;

//是否越狱
+(BOOL)isJK;
+(NSString *)getShortVersionString;
+(NSString *)getBuildVersionString;

+(int)getRandomNumber:(int)from to:(int)to;

+(void)GCD_delay:(CGFloat)t b:(void(^)(void))block;

+(NSString *)notRounding:(float)price afterPoint:(int)position;
+(float)notRoundingFloat:(float)price afterPoint:(int)position;

+(BOOL)isSIMULATOR;

+(BOOL)keyboardMaybeShow:(UIView *)view;
+ (NSString *)getBinaryByDecimal:(NSInteger)decimal;
+(NSArray *)getScanTypes;

@end
